package nbcb;

import java.util.Scanner;

public class L {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n, index;
        int[] arr;
        while (sc.hasNext()){
            n = sc.nextInt();
            if (n == 0) continue;
            arr = new int[n];
            index = 0;
            arr[0] = sc.nextInt();
            for (int i = 1; i < n; i++) {
                arr[i] = sc.nextInt();
                if (arr[i] < arr[index]) index = i;
            }
            swap(arr, 0, index);
            for (int num : arr) System.out.print(num + " ");
            System.out.println();
        }
    }
    public static void swap(int[] arr, int from, int to) {
        int temp = arr[from];
        arr[from] = arr[to];
        arr[to] = temp;
    }
}
